<?php

namespace Home\Controller;

class BrandController extends BaseMallController
{

    function _initialize()
    {
        parent::_initialize();
        $this->_user_id = session('visitor.user_id');
    }

    function index(){
        if(!$_POST['page'] || !$_POST['pagenum']){
            render('10004','参数错误');
        }
        $res = M('brand')->limit($_POST['pagenum'])->page($_POST['page'])->where(array('if_show'=>1))->select();
        if(!$res){
            $res = array();
        }
        $data = array('brand' => $res);
        render('10000','获取成功',$data);
    }

    function get_list(){
        $res = M('brand')->where(array('if_show'=>1))->order('brand_name asc')->select();
        $data = array('brand' => $res);
        render('10000','获取成功',$data);
    }

}
